package com.yoona.service;

import com.yoona.dao.StudentDao;
import com.yoona.entity.Student;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * 学生service层
 * @author YoonaDa
 * @version 2018-10-17
 */
@Service
public class StudentService {

    @Autowired
    private StudentDao studentDao;

    public List<Student> findStudentById(int id){

        return studentDao.findStudentById(id);
    }

    //查出所有数据，并以List的形式返回json
    public List<Student> findList(Student student){
        return studentDao.findList(student);
    }

//    根据id删除一整条学生信息
    @Transactional(readOnly = false)
    public void delete(Student student){
        studentDao.delete(student);
    }


    @Transactional(readOnly = false)
    public void insertList(Student student){
        studentDao.insertList(student);
    }

    @Transactional(readOnly = false)
    public void updateList(Student student){
        studentDao.updateList(student);
    }




}
